import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import '../../common/utils/intent.dart';
import '../../generated/assets.dart';

class NetworkDialog extends StatelessWidget {
  const NetworkDialog({super.key});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        context.pop();
      },
      child: Material(
        color: Colors.transparent,
        child: Center(
          child: GestureDetector(
            onTap: () {},
            child: Container(
              color: Colors.white,
              padding: const EdgeInsets.all(16),
              child: buildContent(),
            ),
          ),
        ),
      ),
    );
  }

  Widget buildContent() {
    return Column(
      mainAxisSize: MainAxisSize.min,
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Image.asset(Assets.iconDialogHeader),
        const Text(
          'Need Internet',
          style: TextStyle(
            fontSize: 40,
            color: Color(0xfff4511e),
            fontWeight: FontWeight.bold,
          ),
        ),
        const Text(
          'Internet is necessary for load all functionality...!!',
          style: TextStyle(
            fontSize: 20,
            color: Color(0xff505050),
            fontWeight: FontWeight.bold,
          ),
          textAlign: TextAlign.center,
        ),
        const SizedBox(height: 32),
        GestureDetector(
          onTap: onClick,
          child: Container(
            margin: const EdgeInsets.symmetric(horizontal: 32),
            padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(30),
              gradient: const LinearGradient(
                  colors: [Color(0x1aff5b5a), Color(0x1aff7e6e)]),
            ),
            child: Container(
              padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(20),
                gradient: const LinearGradient(
                  colors: [Color(0xffff5b5a), Color(0xffff7e6e)],
                ),
              ),
              child: const Center(
                  child: Text(
                'Please Connect To Internet',
                style: TextStyle(fontSize: 18),
              )),
            ),
          ),
        ),
      ],
    );
  }

  void onClick() {
    goWifiSettings();
  }
}
